package DiYiZhou2;

import java.util.Scanner;

public class LianXi8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入今天的年份");
        int nowy= scanner.nextInt();
        System.out.println("请输入今天的月份");
        int nowm= scanner.nextInt();
        System.out.println("请输入今天是几号");
        int nowd= scanner.nextInt();
        System.out.println("请输入你生日的年份");
        int birthy= scanner.nextInt();
        System.out.println("请输入你生日的月份");
        int birthm= scanner.nextInt();
        System.out.println("请输入你生日是几号");
        int birthd= scanner.nextInt();
        int age;
        age=nowy-birthy;
        if (nowm<birthm) {
            age = age - 1;
        }
        if ((nowm==birthd)&&(nowd<birthd) ){
            age=age-1;
        }
        System.out.println("年龄是：" + age);
    }
}
